workspace(name = "skia")

load("//bazel:deps.bzl", "bazel_deps", "c_plus_plus_deps")

bazel_deps()

load("//toolchain:download_toolchains.bzl", "download_toolchains_for_skia")

download_toolchains_for_skia("clang_linux_amd64", "clang_mac", "ndk_linux_amd64")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("//bazel:gcs_mirror.bzl", "gcs_mirror_url")

# See https://github.com/emscripten-core/emsdk/tree/85d27a4a2a60d591613a305b14ae438c2bb3ce11/bazel#setup-instructions
http_archive(
    name = "emsdk",
    sha256 = "cb8cded78f6953283429d724556e89211e51ac4d871fcf38e0b32405ee248e91",
    strip_prefix = "emsdk-3.1.44/bazel",
    urls = gcs_mirror_url(
        sha256 = "cb8cded78f6953283429d724556e89211e51ac4d871fcf38e0b32405ee248e91",
        url = "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.44.tar.gz",
    ),
)

load("@emsdk//:deps.bzl", emsdk_deps = "deps")

# One of the deps here is build_bazel_rules_nodejs, currently version 5.8.0
# If we try to install it ourselves after this, it won't work.
emsdk_deps()

load("@emsdk//:emscripten_deps.bzl", emsdk_emscripten_deps = "emscripten_deps")

emsdk_emscripten_deps(emscripten_version = "3.1.44")

load("@bazel_toolchains//repositories:repositories.bzl", bazel_toolchains_repositories = "repositories")

bazel_toolchains_repositories()

http_archive(
    name = "rules_pkg",
    sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
    urls = gcs_mirror_url(
        sha256 = "8f9ee2dc10c1ae514ee599a8b42ed99fa262b757058f65ad3c384289ff70c4b8",
        url = "https://github.com/bazelbuild/rules_pkg/releases/download/0.9.1/rules_pkg-0.9.1.tar.gz",
    ),
)

load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

#######################################################################################
# Python
#######################################################################################

# https://github.com/bazelbuild/rules_python
http_archive(
    name = "rules_python",
    sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
    strip_prefix = "rules_python-0.9.0",
    urls = gcs_mirror_url(
        sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
        url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.9.0.tar.gz",
    ),
)

# This sets up a hermetic python3, rather than depending on what is installed.
load("@rules_python//python:repositories.bzl", "python_register_toolchains")

python_register_toolchains(
    name = "python3_9",
    # https://github.com/bazelbuild/rules_python/blob/main/python/versions.bzl
    python_version = "3.9",
)

load("@python3_9//:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", "pip_install")

pip_install(
    name = "py_deps",
    python_interpreter_target = interpreter,
    requirements = "//:requirements.txt",
)

#######################################################################################
# Maven
#######################################################################################

# https://github.com/bazelbuild/rules_jvm_external
http_archive(
    name = "rules_jvm_external",
    sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
    strip_prefix = "rules_jvm_external-4.2",
    urls = gcs_mirror_url(
        sha256 = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca",
        url = "https://github.com/bazelbuild/rules_jvm_external/archive/4.2.zip",
    ),
)

load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

rules_jvm_external_setup()

load("@rules_jvm_external//:defs.bzl", "maven_install")

maven_install(
    artifacts = [
        # The version released after this one (1.6.0-rc1) did not resolve unknown symbol errors when
        # building.
        # https://b.corp.google.com/issues/269331711
        "androidx.annotation:annotation:1.5.0",
    ],
    repositories = [
        "https://maven.google.com",
        "https://repo1.maven.org/maven2",
    ],
)

#######################################################################################
# Gazelle
#######################################################################################

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
    ],
)

http_archive(
    name = "bazel_gazelle",
    sha256 = "d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
    ],
)

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")
load("//:go_repositories.bzl", "go_repositories")

# gazelle:repository_macro go_repositories.bzl%go_repositories
go_repositories()

go_rules_dependencies()

# For our Linux RBE pool
go_download_sdk(
    name = "go_sdk_linux_amd64",
    goarch = "amd64",
    goos = "linux",
    version = "1.21.4",
)

# For the host machine
go_download_sdk(
    name = "go_sdk",
    version = "1.21.4",
)

# Do not specify a version here or it will be an error (because we
# specified the version above when downloading SDKs)
go_register_toolchains()

gazelle_dependencies(
    go_repository_default_config = "//:WORKSPACE.bazel",
    go_sdk = "go_sdk",
)

##########################
# Other Go dependencies. #
##########################

load("//bazel:go_googleapis_compatibility_hack.bzl", "go_googleapis_compatibility_hack")

# Compatibility hack to make the github.com/bazelbuild/remote-apis Go module work with rules_go
# v0.41.0 or newer. See the go_googleapis() rule's docstring for details.
go_googleapis_compatibility_hack(
    name = "go_googleapis",
)

# Needed by @com_github_bazelbuild_remote_apis.
http_archive(
    name = "com_google_protobuf",
    sha256 = "b8ab9bbdf0c6968cf20060794bc61e231fae82aaf69d6e3577c154181991f576",
    strip_prefix = "protobuf-3.18.1",
    urls = gcs_mirror_url(
        sha256 = "b8ab9bbdf0c6968cf20060794bc61e231fae82aaf69d6e3577c154181991f576",
        url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.18.1/protobuf-all-3.18.1.tar.gz",
    ),
)

# Originally, we pulled protobuf dependencies as follows:
#
#     load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
#     protobuf_deps()
#
# The protobuf_deps() macro brings in a bunch of dependencies, but by copying the macro body here
# and removing dependencies one by one, "rules_proto" was identified as the only dependency that is
# required to build this repository.
http_archive(
    name = "rules_proto",
    sha256 = "a4382f78723af788f0bc19fd4c8411f44ffe0a72723670a34692ffad56ada3ac",
    strip_prefix = "rules_proto-f7a30f6f80006b591fa7c437fe5a951eb10bcbcf",
    urls = ["https://github.com/bazelbuild/rules_proto/archive/f7a30f6f80006b591fa7c437fe5a951eb10bcbcf.zip"],
)

http_archive(
    name = "com_google_googleapis",
    sha256 = "38701e513aff81c89f0f727e925bf04ac4883913d03a60cdebb2c2a5f10beb40",
    strip_prefix = "googleapis-86fa44cc5ee2136e87c312f153113d4dd8e9c4de",
    urls = [
        "https://github.com/googleapis/googleapis/archive/86fa44cc5ee2136e87c312f153113d4dd8e9c4de.tar.gz",
    ],
)

# Needed by @com_github_bazelbuild_remote_apis for the googleapis protos.
http_archive(
    name = "googleapis",
    build_file = "BUILD.googleapis",
    sha256 = "7b6ea252f0b8fb5cd722f45feb83e115b689909bbb6a393a873b6cbad4ceae1d",
    strip_prefix = "googleapis-143084a2624b6591ee1f9d23e7f5241856642f4d",
    urls = gcs_mirror_url(
        sha256 = "7b6ea252f0b8fb5cd722f45feb83e115b689909bbb6a393a873b6cbad4ceae1d",
        # b/267219467
        url = "https://github.com/googleapis/googleapis/archive/143084a2624b6591ee1f9d23e7f5241856642f4d.zip",
    ),
)

load("@com_google_googleapis//:repository_rules.bzl", googleapis_imports_switched_rules_by_language = "switched_rules_by_language")

googleapis_imports_switched_rules_by_language(
    name = "com_google_googleapis_imports",
    go = True,
    grpc = True,
)

# Needed by @com_github_bazelbuild_remote_apis for gRPC.
http_archive(
    name = "com_github_grpc_grpc",
    sha256 = "b391a327429279f6f29b9ae7e5317cd80d5e9d49cc100e6d682221af73d984a6",
    strip_prefix = "grpc-93e8830070e9afcbaa992c75817009ee3f4b63a0",  # v1.24.3 with fixes
    urls = gcs_mirror_url(
        sha256 = "b391a327429279f6f29b9ae7e5317cd80d5e9d49cc100e6d682221af73d984a6",
        # Fix after https://github.com/grpc/grpc/issues/32259 is resolved
        url = "https://github.com/grpc/grpc/archive/93e8830070e9afcbaa992c75817009ee3f4b63a0.zip",
    ),
)

# Originally, we pulled gRPC dependencies as follows:
#
#     load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
#     grpc_deps()
#
# The grpc_deps() macro brings in a bunch of dependencies, but by copying the macro body here
# and removing dependencies one by one, "zlib" was identified as the only dependency that is
# required to build this repository.
http_archive(
    name = "zlib",
    build_file = "@com_github_grpc_grpc//third_party:zlib.BUILD",
    sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45",
    strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
    url = "https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz",
)

###################################################
# JavaScript / TypeScript rules and dependencies. #
###################################################

# The npm_install rule runs anytime the package.json or package-lock.json file changes. It also
# extracts any Bazel rules distributed in an npm package.
load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")

# Manages the node_modules directory.
npm_install(
    name = "npm",
    package_json = "//:package.json",
    package_lock_json = "//:package-lock.json",
)

# io_bazel_rules_webtesting allows us to download browsers in a hermetic, repeatable way. This
# currently includes Chromium and Firefox. Note that the version on this does not necessarily
# match the version below of the browsers-X.Y.Z below that is available.
http_archive(
    name = "io_bazel_rules_webtesting",
    sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
    urls = gcs_mirror_url(
        sha256 = "e9abb7658b6a129740c0b3ef6f5a2370864e102a5ba5ffca2cea565829ed825a",
        url = "https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.5/rules_webtesting.tar.gz",
    ),
)

# https://github.com/bazelbuild/rules_webtesting/blob/e9cf17123068b1123c68219edf9b274bf057b9cc/web/versioned/browsers-0.3.3.bzl
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.3.bzl", "browser_repositories")

browser_repositories(
    chromium = True,
    firefox = True,
)

###################################################
# Rust rules and dependencies.                    #
###################################################

http_archive(
    name = "rules_rust",
    integrity = "sha256-GuRaQT0LlDOYcyDfKtQQ22oV+vtsiM8P0b87qsvoJts=",
    urls = gcs_mirror_url(
        sha256 = "1ae45a413d0b9433987320df2ad410db6a15fafb6c88cf0fd1bf3baacbe826db",
        url = "https://github.com/bazelbuild/rules_rust/releases/download/0.39.0/rules_rust-v0.39.0.tar.gz",
    ),
)

load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")

# https://github.com/bazelbuild/rules_rust/blob/5c715ec50602e2ba6ca2ebfdd870662a6e6d1eda/rust/repositories.bzl#L48
rules_rust_dependencies()

rust_register_toolchains(
    edition = "2021",
    extra_target_triples = ["aarch64-apple-darwin"],
    versions = [
        # supported versions from https://github.com/bazelbuild/rules_rust/blob/5c715ec50602e2ba6ca2ebfdd870662a6e6d1eda/util/fetch_shas_VERSIONS.txt
        # The rust rules validate a toolchain by sha256 hash, as listed in https://github.com/bazelbuild/rules_rust/blob/5c715ec50602e2ba6ca2ebfdd870662a6e6d1eda/rust/known_shas.bzl
        "1.76.0",
    ],
)

# https://bazelbuild.github.io/rules_rust/crate_universe.html
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")

crate_universe_dependencies()

# cxxbridge-cmd is a binary only Rust crate, so we follow these instructions for it
# http://bazelbuild.github.io/rules_rust/crate_universe.html#binary-dependencies
# If we need to update this, replace the Cargo.lock files with empty (existing) files and then
# CARGO_BAZEL_REPIN=1 bazel sync --only=crate_index
http_archive(
    name = "cxxbridge_cmd",
    build_file = "//bazel/external/cxxbridge_cmd:BUILD.bazel.skia",
    sha256 = "b20c2a31fb5a2e2aeebced19e35d78a974301171391b39e36d5ebb00bea2aa93",
    strip_prefix = "cxxbridge-cmd-1.0.94",
    type = "tar.gz",
    urls = gcs_mirror_url(
        ext = ".tar.gz",
        sha256 = "b20c2a31fb5a2e2aeebced19e35d78a974301171391b39e36d5ebb00bea2aa93",
        url = "https://crates.io/api/v1/crates/cxxbridge-cmd/1.0.94/download",
    ),
)

load("@rules_rust//crate_universe:defs.bzl", "crates_repository")

# This finds all the dependencies needed to build cxxbridge_cmd...
crates_repository(
    name = "cxxbridge_cmd_deps",
    cargo_lockfile = "//bazel/external/cxxbridge_cmd:Cargo.lock",
    manifests = ["@cxxbridge_cmd//:Cargo.toml"],
)

load("@cxxbridge_cmd_deps//:defs.bzl", cxxbridge_cmd_deps = "crate_repositories")

# ... and adds them to the workspace.
cxxbridge_cmd_deps()

# The cxx crate needs a custom BUILD.bazel file because the one that would be autogenerated
# by http://bazelbuild.github.io/rules_rust/crate_universe.html#direct-packages does not work.
# Thus, we download it ourselves, as if it were a binary-only package.
http_archive(
    name = "cxx",
    build_file = "//bazel/external/cxx:BUILD.bazel.skia",
    sha256 = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93",
    strip_prefix = "cxx-1.0.94",
    type = "tar.gz",
    urls = gcs_mirror_url(
        ext = ".tar.gz",
        sha256 = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93",
        url = "https://crates.io/api/v1/crates/cxx/1.0.94/download",
    ),
)

# This finds all the dependencies needed to build cxx...
crates_repository(
    name = "cxx_deps",
    cargo_lockfile = "//bazel/external/cxx:Cargo.lock",
    manifests = ["@cxx//:Cargo.toml"],
)

load("@cxx_deps//:defs.bzl", cxx_deps = "crate_repositories")

# ... and adds them to the workspace.
cxx_deps()

# The fontations repository consists of multiple crates. We download those
# listed in the external/fontations/Cargo.* files.
# Add this entry to have a root repository from which the individual
# fontations crates can be fetched.
# This allows them to be used as deps in other bazel targets.
crates_repository(
    name = "fontations",
    cargo_lockfile = "//bazel/external/fontations:Cargo.lock",
    manifests = ["//bazel/external/fontations:Cargo.toml"],
)

load("@fontations//:defs.bzl", fontations_crates = "crate_repositories")

fontations_crates()

# The icu4x repository consists of multiple crates. We download those
# listed in the external/icu4x/Cargo.* files.
# Add this entry to have a root repository from which the individual
# icu4x crates can be fetched.
# This allows them to be used as deps in other bazel targets.
crates_repository(
    name = "icu4x_deps",
    cargo_lockfile = "//bazel/external/icu4x:Cargo.lock",
    manifests = ["//bazel/external/icu4x:Cargo.toml"],
)

load("@icu4x_deps//:defs.bzl", icu4x_deps = "crate_repositories")

icu4x_deps()

# Skia uses crates from the vello repository that are under development and have not been published
# to crates.io. Normally we could fetch them directly from the git mirror in the Cargo.lock file as
# Bazel supports compiling them without any custom build rules. However, since Bazel's repository
# rules don't play well with the vello_shader crate's build script, we compile the vello
# crates from source using the rules defined in bazel/external/vello/BUILD.bazel and the
# new_git_repository rule.
#
# vello_deps contains the dependencies of the two crates we build out of the vello repo (namely
# vello_shaders and vello_encoding).
#
# See comments in bazel/external/vello/BUILD.bazel for more information.
crates_repository(
    name = "vello_deps",
    cargo_lockfile = "//bazel/external/vello:Cargo.lock",
    manifests = ["//bazel/external/vello:Cargo.toml"],
)

load("@vello_deps//:defs.bzl", vello_deps = "crate_repositories")

vello_deps()

###############################################################

# Bazel will look for env variables ANDROID_HOME and ANDROID_NDK_HOME.
# This is NOT hermetic as it requires the user to handle downloading the SDK  and accepting the
# license independently.
android_sdk_repository(name = "androidsdk")
# TODO: skbug.com/14128
# Uncomment the following after setting ANDROID_NDK_HOME to build for Android:
# android_ndk_repository(name = "androidndk")

# Clients must specify their own version of skia_user_config to overwrite SkUserConfig.h
local_repository(
    name = "skia_user_config",
    path = "include/config",
)

# This are two lists of Bazel repository names, which is brought in by the following macro.
# It is here for easier grepping, i.e. someone trying to find where a label like @brotli//:brotlidec
# was defined. If a dep has its own BUILD rules, then one will need to go to its git repository
# to find the BUILD or BUILD.bazel file with the rule. If a dep does not have Bazel support, then
# that means someone on the Skia team wrote a BUILD.bazel file and put it in
# //bazel/external/<dep_name> and one can go find it there.
#
#### START GENERATED LIST OF THIRD_PARTY DEPS
# @abseil_cpp - https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git
# @brotli - https://skia.googlesource.com/external/github.com/google/brotli.git
# @highway - https://chromium.googlesource.com/external/github.com/google/highway.git
# @spirv_headers - https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git
# @spirv_tools - https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git
#
# @dawn - //bazel/external/dawn:BUILD.bazel
# @dng_sdk - //bazel/external/dng_sdk:BUILD.bazel
# @expat - //bazel/external/expat:BUILD.bazel
# @freetype - //bazel/external/freetype:BUILD.bazel
# @harfbuzz - //bazel/external/harfbuzz:BUILD.bazel
# @icu - //bazel/external/icu:BUILD.bazel
# @icu4x - //bazel/external/icu4x:BUILD.bazel
# @imgui - //bazel/external/imgui:BUILD.bazel
# @libavif - //bazel/external/libavif:BUILD.bazel
# @libgav1 - //bazel/external/libgav1:BUILD.bazel
# @libjpeg_turbo - //bazel/external/libjpeg_turbo:BUILD.bazel
# @libjxl - //bazel/external/libjxl:BUILD.bazel
# @libpng - //bazel/external/libpng:BUILD.bazel
# @libwebp - //bazel/external/libwebp:BUILD.bazel
# @libyuv - //bazel/external/libyuv:BUILD.bazel
# @perfetto - //bazel/external/perfetto:BUILD.bazel
# @piex - //bazel/external/piex:BUILD.bazel
# @spirv_cross - //bazel/external/spirv_cross:BUILD.bazel
# @vello - //bazel/external/vello:BUILD.bazel
# @vulkan_headers - //bazel/external/vulkan_headers:BUILD.bazel
# @vulkan_tools - //bazel/external/vulkan_tools:BUILD.bazel
# @vulkan_utility_libraries - //bazel/external/vulkan_utility_libraries:BUILD.bazel
# @vulkanmemoryallocator - //bazel/external/vulkanmemoryallocator:BUILD.bazel
# @wuffs - //bazel/external/wuffs:BUILD.bazel
# @zlib_skia - //bazel/external/zlib_skia:BUILD.bazel
#### END GENERATED LIST OF THIRD_PARTY DEPS
c_plus_plus_deps()

# In order to copy the Freetype configurations into the checked out Freetype folder,
# it is easiest to treat them as a third-party dependency from the perspective of Freetype.
# To do that, we put them in their own Bazel workspace and then have our injected BUILD.bazel
# for Freetype reference this workspace.
# https://bazel.build/reference/be/workspace#new_local_repository
local_repository(
    name = "freetype_config",
    path = "bazel/external/freetype/config",
)

local_repository(
    name = "harfbuzz_config",
    path = "bazel/external/harfbuzz/config",
)

local_repository(
    name = "icu_utils",
    path = "bazel/external/icu/utils",
)

local_repository(
    name = "expat_config",
    path = "bazel/external/expat/config",
)

load("//bazel:cipd_install.bzl", "cipd_install")

cipd_install(
    name = "git_linux_amd64",
    build_file_content = """
filegroup(
  name = "all_files",
  # The exclude pattern prevents files with spaces in their names from tripping up Bazel.
  srcs = glob(include=["**/*"], exclude=["**/* *"]),
  visibility = ["//visibility:public"],
)
""",
    cipd_package = "infra/3pp/tools/git/linux-amd64",
    # Based on
    # https://skia.googlesource.com/buildbot/+/f1d21dc58818cd6aba0a7822e59d37636aefe936/WORKSPACE#391.
    #
    # Note that the below "git config" commands do not affect the user's Git configuration. These
    # settings are only visible to Bazel targets that depend on @git_linux_amd64//:all_files via
    # the "data" attribute. The result of these commands can be examined as follows:
    #
    #     $ cat $(bazel info output_base)/external/git_linux_amd64/etc/gitconfig
    #     [user]
    #             name = Bazel Test User
    #             email = bazel-test-user@example.com
    postinstall_cmds_posix = [
        "mkdir etc",
        "bin/git config --system user.name \"Bazel Test User\"",
        "bin/git config --system user.email \"bazel-test-user@example.com\"",
    ],
    # From https://chrome-infra-packages.appspot.com/p/infra/3pp/tools/git/linux-amd64/+/version:2.29.2.chromium.6
    sha256 = "36cb96051827d6a3f6f59c5461996fe9490d997bcd2b351687d87dcd4a9b40fa",
    tag = "version:2.29.2.chromium.6",
)

cipd_install(
    name = "gn_linux_amd64",
    build_file_content = """
exports_files(
    ["gn"],
    visibility = ["//visibility:public"]
)
""",
    cipd_package = "gn/gn/linux-amd64",
    # From https://chrome-infra-packages.appspot.com/p/gn/gn/linux-amd64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
    sha256 = "7195291488d08f3a10e85b85d8c4816e077015f1c5f196f770003a97aa42caf8",
    tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
)

cipd_install(
    name = "gn_mac_arm64",
    build_file_content = """
exports_files(
    ["gn"],
    visibility = ["//visibility:public"]
)
""",
    cipd_package = "gn/gn/mac-arm64",
    # From https://chrome-infra-packages.appspot.com/p/gn/gn/mac-arm64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
    sha256 = "1123907ac3317530e9dd537d50cd83fd83e852aacc07d286f45753c8fc5287ed",
    tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
)

cipd_install(
    name = "gn_mac_amd64",
    build_file_content = """
exports_files(
    ["gn"],
    visibility = ["//visibility:public"]
)
""",
    cipd_package = "gn/gn/mac-amd64",
    # From https://chrome-infra-packages.appspot.com/p/gn/gn/mac-amd64/+/git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41
    sha256 = "ed96f7d2f49b83b016e4bdbed432e4734a5a133accb025d7c07685e01489ba93",
    tag = "git_revision:1c4151ff5c1d6fbf7fa800b8d4bb34d3abc03a41",
)

cipd_install(
    name = "skimage",
    build_file = "//bazel/external/skimage:BUILD.bazel",
    cipd_package = "skia/bots/skimage",
    # From https://chrome-infra-packages.appspot.com/p/skia/bots/skimage/+/sRladEfUAXeYIBD3Pt3ke0Fd08vtYVLrg4IASKk5F6YC
    sha256 = "b1195a7447d40177982010f73edde47b415dd3cbed6152eb83820048a93917a6",
    tag = "version:47",
)

##################################
# Docker rules and dependencies. #
##################################

http_archive(
    name = "io_bazel_rules_docker",
    sha256 = "27d53c1d646fc9537a70427ad7b034734d08a9c38924cc6357cc973fed300820",
    strip_prefix = "rules_docker-0.24.0",
    urls = gcs_mirror_url(
        sha256 = "27d53c1d646fc9537a70427ad7b034734d08a9c38924cc6357cc973fed300820",
        url = "https://github.com/bazelbuild/rules_docker/releases/download/v0.24.0/rules_docker-v0.24.0.tar.gz",
    ),
)

load(
    "@io_bazel_rules_docker//repositories:repositories.bzl",
    container_repositories = "repositories",
)

container_repositories()

# This is required by the toolchain_container rule.
load(
    "@io_bazel_rules_docker//repositories:go_repositories.bzl",
    container_go_deps = "go_deps",
)

container_go_deps()

load(
    "@io_bazel_rules_docker//container:container.bzl",
    "container_pull",
)

# Pulls the gcr.io/skia-public/debugger-app-base container.
container_pull(
    name = "debugger-app-base",
    digest = "sha256:24edbde4082b5bbfc6b52ca8a88d974a6898a134bca815348a72e89598fba4a9",
    registry = "gcr.io",
    repository = "skia-public/debugger-app-base",
)

# Pulls the gcr.io/skia-public/jsfiddle-base container.
container_pull(
    name = "jsfiddle-base",
    digest = "sha256:453d00b44c6baac7c5a6a27d00a0b51805e8636cbfb8da176c7c33dc3728bb3f",
    registry = "gcr.io",
    repository = "skia-public/jsfiddle-base",
)

# Pulls the gcr.io/skia-public/shaders-base container.
container_pull(
    name = "shaders-base",
    digest = "sha256:cbf986e97789cab9c3fc6bdb82c12a2330ca75ba473607f5daf29f9747ae9a45",
    registry = "gcr.io",
    repository = "skia-public/shaders-base",
)

# Pulls the gcr.io/skia-public/skottie-base container.
container_pull(
    name = "skottie-base",
    digest = "sha256:9727f56830b976b5567c9ce10b3505f6ee1c9e69af0e6bb749bfd74dc42c37c1",
    registry = "gcr.io",
    repository = "skia-public/skottie-base",
)
